package com.woniuxy.education.service.impl;

import com.woniuxy.education.entity.DataInformation;
import com.woniuxy.education.entity.TeacherInformation;
import com.woniuxy.education.mapper.SelectTeacherDataMapper;
import com.woniuxy.education.service.SelectTeacherDataService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class SelectTeacherDataServiceImpl implements SelectTeacherDataService {
    @Autowired
    SelectTeacherDataMapper selectTeacherDataMapper;
    public TeacherInformation selectTinformation(String account){
        TeacherInformation ti=new TeacherInformation();
        String tname=selectTeacherDataMapper.selectTname(account);
        ti=selectTeacherDataMapper.selectTinformation(tname);
        return ti;
    }
    public void update(String name,String tel){
        selectTeacherDataMapper.update(name, tel);
    }
    public DataInformation updatePassword(String name,String oldpassword,String newpassword){
        DataInformation df=new DataInformation();
        if(selectTeacherDataMapper.selectAccount(name).equals(oldpassword)){
            selectTeacherDataMapper.updatePassword(name, newpassword);

            df.setStatu(200);
        }else {

            df.setStatu(500);
            df.setMessage("原密码错误");
        }
        return df;

    }
}
